package com.zengjianjun.base.log.config;

import com.zengjianjun.base.log.aop.LogAspect;
import com.zengjianjun.base.log.appender.ErrorLogNoticeAppender;
import com.zengjianjun.base.log.properties.BaseLogProperties;
import com.zengjianjun.base.log.utils.SpringUtil;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author zengjianjun
 */
@Configuration
@EnableConfigurationProperties({BaseLogProperties.class})
public class BaseLogAutoConfiguration {

    @Resource
    private BaseLogProperties baseLogProperties;

    @Bean
    public LogAspect customLogger() {
        return new LogAspect();
    }

    @Bean
    public SpringUtil springUtil() {
        return new SpringUtil();
    }

    @Bean
    public ErrorLogNoticeAppender errorLogNoticeAppender() {
        return new ErrorLogNoticeAppender();
    }
}
